package com.docs2swf.model;

import java.io.File;
import java.util.ArrayList;

import org.apache.struts2.ServletActionContext;


public class SWFileBean {
	private String dir;
	private ArrayList<SWFile> list; 
	public String getDir() {
		return dir;
	}

	public void setDir(String dir) {
		this.dir = dir;
	}

	public ArrayList<SWFile> getList() {
		File files = new File(ServletActionContext.getServletContext().getRealPath("/output"));
		if (this.list == null)
			list = new ArrayList<SWFile>();
		for(String file : files.list() ){
			File instance = new File(files.getPath()+"\\"+file);
			if(instance.isFile()){
				list.add(new SWFile(instance.getName(),instance.getPath()+"\\"+file));
			}
        }
		return list;
	}

	
	
}
